<template>
	<view>
		<view class="top">
			<view class="bgbox">
				<image class="bg" src="/static/img/minetopbg.jpg" mode=""></image>
			</view>
			<view class="" style="position: absolute;width: 750rpx;height: 357rpx;">
				<u-navbar title="我的" leftIcon=' ' titleStyle='color:#fff;font-size:36rpx;' bgColor='transparent'>
				</u-navbar>
				<view class="perinfo flex">
					<view class="flex">
						<image class="avatar" :src="userInfo.avatar" mode="aspectFill"></image>
						<view class="info">
							<view class="name">
								{{ userInfo.nickname }}
							</view>
							<view class="infoid">
								ID:{{ userInfo.id }}
							</view>
							<view class="code flex">
								邀请码:{{userInfo.invite}}
								<view class="copy" @click="copy">
									复制
								</view>
							</view>
						</view>
					</view>
					<view class="edit_btn flex" @click="goto('/pages/userinfo/userinfo')">
						<image style="width: 100%;height: 100%;" src="/static/img/edit.png" mode=""></image>
					</view>
				</view>
			</view>
		</view>
		<view class="title flex">
			<view class="title_name">
				我的订单
			</view>
			<view class="more" @click="goto('/pages/order/myorder?status=0')">
				全部订单
				<image class="right_icon" src="/static/img/more.png" mode=""></image>
			</view>
		</view>
		<view class="" style="margin-bottom: 70rpx;">
			<u-grid :border="false" col='3'>
				<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex"
					@click="clickto(baseListItem)">
					<image :src="baseListItem.name" style="margin-top: 54rpx;width: 43rpx;height: 43rpx;" mode="">
					</image>
					<text class="grid-text">{{baseListItem.title}}</text>
				</u-grid-item>
			</u-grid>
		</view>
		<view class="title flex">
			<view class="title_name">
				必备工具
			</view>
		</view>
		<view class="" style="">
			<u-grid :border="false" col='4'>
				<u-grid-item v-for="(baseListItem,baseListIndex) in baseList1" :key="baseListIndex" @click="clickto(baseListItem)">
					<image :src="baseListItem.name" style="margin-top: 54rpx;width: 43rpx;height: 43rpx;" mode="">
					</image>
					<text class="grid-text">{{baseListItem.title}}</text>
				</u-grid-item>
			</u-grid>
		</view>
	</view>
</template>

<script>
	import {
		userInfo
	} from '@/api/my.js'
	export default {
		data() {
			return {
				baseList: [
					// {
					// 	name: '/static/img/tab1.png',
					// 	title: '待付款',
					// 	url: '/pages/order/myorder?status=0'
					// },
					{
						name: '/static/img/tab2.png',
						title: '待发货',
						url: '/pages/order/myorder?status=1'
					},
					{
						name: '/static/img/tab3.png',
						title: '待收货',
						url: '/pages/order/myorder?status=2'
					},
					{
						name: '/static/img/tab4.png',
						title: '已完成',
						url: '/pages/order/myorder?status=3'
					},
				],
				baseList1: [{
						name: '/static/img/tab11.png',
						title: '邀请好友',
						url: '/pages/friend/list',
					},
					{
						name: '/static/img/tab12.png',
						title: '我的钱包',
						url: '/pages/wallet/wallet'
					},
					{
						name: '/static/img/tab13.png',
						title: '积分兑换',
						url: '/pages/integral/integral'
					},
					{
						name: '/static/img/tab14.png',
						title: '商务合作',
						url: '/pages/cooperation/cooperation'
					},
					{
						name: '/static/img/tab15.png',
						title: '邀请海报',
						url: '/pages/friend/sharehaib'
					},
					{
						name: '/static/img/tab16.png',
						title: '留言评论',
						url: '/pages/comment/comment'
					},
					{
						name: '/static/img/tab17.png',
						title: '我的发布',
						url: '/pages/project/myproject'
					},
					{
						name: '/static/img/tab18.png',
						title: '联系方式',
						url: '/pages/kefu/callus'
					},
					// {
					// 	name: '/static/img/zfxm.png',
					// 	title: '政府项目',
					// 	url: '/pages/project/zfxm'
					// },
					// {
					// 	name: '/static/img/jp.png',
					// 	title: '商品竞拍',
					// 	url: '/pages/jp/list'
					// },
				],
				userInfo: {}
			};
		},
		methods: {

			clickto(item) {
				uni.$u.route(item.url, {
					from: 'mine'
				});
			},
			goto(url) {
				uni.$u.route(url, {
					from: 'mine'
				});
			},
			copy(){
				uni.setClipboardData({
					data: this.userInfo.invite,
					success: function () {
						// console.log('success');	
						uni.showToast({
							title:'已复制',
							icon:'none'
						})
					}
				});
			},
			getUserInfo() {
				userInfo().then(res=>{
					uni.setStorageSync('userinfo',res.data.data)
					this.userInfo=uni.getStorageSync('userinfo')
				})
			}
		},
		onShow() {
			this.getUserInfo()
			
		}
	}
</script>

<style lang="less">
	.top {
		width: 750rpx;
		height: 357rpx;
		position: relative;
		// margin-bottom: 113rpx;

		.bg {
			width: 750rpx;
			height: 357rpx;
			position: absolute;
		}

		.top_title {
			padding-top: 50rpx;
			text-align: center;
			font-size: 36rpx;
			color: #fff;
		}

		.perinfo {
			width: calc(750rpx - 35rpx - 31rpx);
			justify-content: space-between;
			padding: 0 35rpx 0 31rpx;
			position: absolute;
			bottom: 45rpx;
			.avatar {
				width: 134rpx;
				height: 134rpx;
				border-radius: 50%;
				border: 8rpx solid #fd874c;
			}

			.info {
				color: #fff;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				margin-left: 14rpx;
				height: 150rpx;

				.name {
					font-size: 32rpx;
					font-weight: bold;
					margin-top: 15rpx;
				}

				.infoid {
					font-size: 30rpx;
				}

				.code {
					font-size: 24rpx;
					margin-bottom: 24rpx;

					.copy {
						line-height: 28rpx;
						border: 1rpx solid #FFFFFF;
						border-radius: 14rpx;
						padding: 0 10rpx;
						margin-left: 16rpx;
					}
				}
			}

			.edit_btn {
				width: 126rpx;
				height: 52rpx;
			}
		}
	}

	.xiansbox {
		position: absolute;
		bottom: -94rpx;
		width: calc(692rpx - 166rpx);
		height: 157rpx;
		box-shadow: 0px 0px 43rpx 0px rgba(83, 28, 0, 0.15);
		background-color: #fff;
		border-radius: 20rpx;
		justify-content: space-between;
		padding: 0 83rpx;
		left: 30rpx;

		.xsitem {
			text-align: center;

			.item_num {
				font-size: 36rpx;
				color: #333;
				font-weight: bold;
				margin-bottom: 10rpx;
			}

			.item_name {
				color: #969696;
				font-size: 24rpx;
			}
		}

		.item_line {
			width: 2rpx;
			height: 40rpx;
			background: #EAEAEA;
		}
	}

	.title {
		justify-content: space-between;
		padding: 0 32rpx;
		margin-top: 50rpx;

		.title_name {
			font-size: 32rpx;
			color: #333;
			font-weight: bold;
		}

		.more {
			font-size: 24rpx;
			color: #999999;

			.right_icon {
				width: 13rpx;
				height: 21rpx;
				margin-left: 8rpx;
			}
		}
	}

	.flex {
		display: flex;
		align-items: center;
	}

	.grid-text {
		font-size: 26rpx;
		color: #333;
		margin-top: 20rpx;
	}

	.bgbox {
		width: 750rpx;
		overflow: hidden;
		position: absolute;
		height: 357rpx;
		// background-color: #fb6013;
	}
</style>
